home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / PCI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  6.5 KB  |  207 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        PCI.h
  3.  
  4.      Contains:    PCI Bus Interfaces.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __PCI__
  19. #define __PCI__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __NAMEREGISTRY__
  25. #include <NameRegistry.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. /* Types and structures for accessing the PCI Assigned-Address property.*/
  51.  
  52. #define kPCIAssignedAddressProperty "assigned-addresses"
  53.  
  54. enum {
  55.     kPCIRelocatableSpace        = 0x80,
  56.     kPCIPrefetchableSpace        = 0x40,
  57.     kPCIAliasedSpace            = 0x20,
  58.     kPCIAddressTypeCodeMask        = 0x03,
  59.     kPCIConfigSpace                = 0,
  60.     kPCIIOSpace                    = 1,
  61.     kPCI32BitMemorySpace        = 2,
  62.     kPCI64BitMemorySpace        = 3
  63. };
  64.  
  65. typedef UInt8                             PCIAddressSpaceFlags;
  66.  
  67. enum {
  68.     kPCIDeviceNumberMask        = 0x1F,
  69.     kPCIFunctionNumberMask        = 0x07
  70. };
  71.  
  72. typedef UInt8                             PCIDeviceFunction;
  73. typedef UInt8                             PCIBusNumber;
  74. typedef UInt8                             PCIRegisterNumber;
  75.  
  76. struct PCIAssignedAddress {
  77.     PCIAddressSpaceFlags             addressSpaceFlags;
  78.     PCIBusNumber                     busNumber;
  79.     PCIDeviceFunction                 deviceFunctionNumber;
  80.     PCIRegisterNumber                 registerNumber;
  81.     UnsignedWide                     address;
  82.     UnsignedWide                     size;
  83. };
  84. typedef struct PCIAssignedAddress        PCIAssignedAddress;
  85. typedef PCIAssignedAddress *            PCIAssignedAddressPtr;
  86. #define GetPCIIsRelocatable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIRelocatableSpace)
  87. #define GetPCIIsPrefetchable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIPrefetchableSpace)
  88. #define GetPCIIsAliased( AssignedAddressPtr )            ((AssignedAddressPtr)->addressSpaceFlags & kPCIAliasedSpace)
  89. #define GetPCIAddressSpaceType( AssignedAddressPtr )    ((AssignedAddressPtr)->addressSpaceFlags & kPCIAddressTypeCodeMask)
  90. #define GetPCIBusNumber( AssignedAddressPtr )            ((AssignedAddressPtr)->busNumber)
  91. #define GetPCIDeviceNumber( AssignedAddressPtr )        (((AssignedAddressPtr)->deviceFunctionNumber >> 3) & kPCIDeviceNumberMask)
  92. #define GetPCIFunctionNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->deviceFunctionNumber & kPCIFunctionNumberMask)
  93. #define GetPCIRegisterNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->registerNumber)
  94.  
  95.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  96.                                                                                             #pragma parameter __D0 EndianSwap16Bit(__D0)
  97.                                                                                             #endif
  98. EXTERN_API( UInt16 )
  99. EndianSwap16Bit                    (UInt16                 data16)                                ONEWORDINLINE(0xE158);
  100.  
  101.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  102.                                                                                             #pragma parameter __D0 EndianSwap32Bit(__D0)
  103.                                                                                             #endif
  104. EXTERN_API( UInt32 )
  105. EndianSwap32Bit                    (UInt32                 data32)                                THREEWORDINLINE(0xE158, 0x4840, 0xE158);
  106.  
  107. EXTERN_API( OSErr )
  108. ExpMgrConfigReadByte            (RegEntryIDPtr             node,
  109.                                  LogicalAddress         configAddr,
  110.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0620, 0xAAF3);
  111.  
  112. EXTERN_API( OSErr )
  113. ExpMgrConfigReadWord            (RegEntryIDPtr             node,
  114.                                  LogicalAddress         configAddr,
  115.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0621, 0xAAF3);
  116.  
  117. EXTERN_API( OSErr )
  118. ExpMgrConfigReadLong            (RegEntryIDPtr             node,
  119.                                  LogicalAddress         configAddr,
  120.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0622, 0xAAF3);
  121.  
  122. EXTERN_API( OSErr )
  123. ExpMgrConfigWriteByte            (RegEntryIDPtr             node,
  124.                                  LogicalAddress         configAddr,
  125.                                  UInt8                     value)                                THREEWORDINLINE(0x303C, 0x0523, 0xAAF3);
  126.  
  127. EXTERN_API( OSErr )
  128. ExpMgrConfigWriteWord            (RegEntryIDPtr             node,
  129.                                  LogicalAddress         configAddr,
  130.                                  UInt16                 value)                                THREEWORDINLINE(0x303C, 0x0524, 0xAAF3);
  131.  
  132. EXTERN_API( OSErr )
  133. ExpMgrConfigWriteLong            (RegEntryIDPtr             node,
  134.                                  LogicalAddress         configAddr,
  135.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x0625, 0xAAF3);
  136.  
  137. EXTERN_API( OSErr )
  138. ExpMgrIOReadByte                (RegEntryIDPtr             node,
  139.                                  LogicalAddress         ioAddr,
  140.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0626, 0xAAF3);
  141.  
  142. EXTERN_API( OSErr )
  143. ExpMgrIOReadWord                (RegEntryIDPtr             node,
  144.                                  LogicalAddress         ioAddr,
  145.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0627, 0xAAF3);
  146.  
  147. EXTERN_API( OSErr )
  148. ExpMgrIOReadLong                (RegEntryIDPtr             node,
  149.                                  LogicalAddress         ioAddr,
  150.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0628, 0xAAF3);
  151.  
  152. EXTERN_API( OSErr )
  153. ExpMgrIOWriteByte                (RegEntryIDPtr             node,
  154.                                  LogicalAddress         ioAddr,
  155.                                  UInt8                     value)                                THREEWORDINLINE(0x303C, 0x0529, 0xAAF3);
  156.  
  157. EXTERN_API( OSErr )
  158. ExpMgrIOWriteWord                (RegEntryIDPtr             node,
  159.                                  LogicalAddress         ioAddr,
  160.                                  UInt16                 value)                                THREEWORDINLINE(0x303C, 0x052A, 0xAAF3);
  161.  
  162. EXTERN_API( OSErr )
  163. ExpMgrIOWriteLong                (RegEntryIDPtr             node,
  164.                                  LogicalAddress         ioAddr,
  165.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x062B, 0xAAF3);
  166.  
  167. EXTERN_API( OSErr )
  168. ExpMgrInterruptAcknowledgeReadByte (RegEntryIDPtr         entry,
  169.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0411, 0xAAF3);
  170.  
  171. EXTERN_API( OSErr )
  172. ExpMgrInterruptAcknowledgeReadWord (RegEntryIDPtr         entry,
  173.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0412, 0xAAF3);
  174.  
  175. EXTERN_API( OSErr )
  176. ExpMgrInterruptAcknowledgeReadLong (RegEntryIDPtr         entry,
  177.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0413, 0xAAF3);
  178.  
  179. EXTERN_API( OSErr )
  180. ExpMgrSpecialCycleWriteLong        (RegEntryIDPtr             entry,
  181.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x0419, 0xAAF3);
  182.  
  183. EXTERN_API( OSErr )
  184. ExpMgrSpecialCycleBroadcastLong    (UInt32                 value)                                THREEWORDINLINE(0x303C, 0x021A, 0xAAF3);
  185.  
  186.  
  187. #if PRAGMA_STRUCT_ALIGN
  188.     #pragma options align=reset
  189. #elif PRAGMA_STRUCT_PACKPUSH
  190.     #pragma pack(pop)
  191. #elif PRAGMA_STRUCT_PACK
  192.     #pragma pack()
  193. #endif
  194.  
  195. #ifdef PRAGMA_IMPORT_OFF
  196. #pragma import off
  197. #elif PRAGMA_IMPORT
  198. #pragma import reset
  199. #endif
  200.  
  201. #ifdef __cplusplus
  202. }
  203. #endif
  204.  
  205. #endif /* __PCI__ */
  206.  
  207.